package com.vcredit.creditcat.service;
import com.vcredit.creditcat.model.CustCatfood;
import com.vcredit.creditcat.persistence.base.CustCatfoodMapper;
import com.vcredit.creditcat.util.Utility;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * 
 **/
@Service
public class CustCatfoodService {
	@Autowired
    private CustCatfoodMapper mapper;
    
    public void insert(CustCatfood obj){
    	mapper.insert(obj);
    }
    
    public void update(CustCatfood obj){
    	mapper.update(obj);
    }
    
    public List<CustCatfood> findAll(){
		return mapper.findAll();
	}
	
	public List<CustCatfood> find(CustCatfood obj){
		return mapper.find(obj);
	}
	
	public CustCatfood findByCustId(Long custId){
		CustCatfood custCatfood = new CustCatfood();
		custCatfood.setCustId(custId);
		List<CustCatfood> list = this.find(custCatfood);
		if(Utility.isNullOrEmpty(list)) {
			return null;
		}
		return list.get(0);
	}
}